#include <iostream>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[])
{
    int l, r, i, t, result = 0;
    cin >> l >> r;
    for (i = l; i <= r; i++)
    {
        t = i;
        while (t)
        {
            if (t % 10 == 2)
            {
                result++;
            }
            t /= 10;            
        }
    }
    cout << result;
    
    return 0;
}